<template>
	<div>
		<el-form ref="form" :rules="rules" :model="form" label-width="120px">


			<el-form-item label="档案编号" prop="fileNumber">
				<el-input v-model="form.fileNumber"></el-input>
			</el-form-item>
			<el-form-item label="姓名" prop="name">
				<el-input v-model="form.name"></el-input>
			</el-form-item>
			<el-form-item label="性别" prop="gender">
				
				
				 <el-select v-model="form.gender" placeholder="请选择">
				    <el-option
				      v-for="item in options"
				      :key="item.value"
				      :label="item.label"
				      :value="item.label">
					<!-- <el-input v-model="form.status"></el-input> -->
					  
				    </el-option>
				  </el-select>
			</el-form-item>

			</el-form-item>
				<el-form-item label="床位起始时间" prop="startTime">
					<span class="demonstration"></span>
					    <el-date-picker
					      v-model="form.startTime "
					      type="date"
						  value-format="yyyy-MM-dd"
					      placeholder="选择日期">时间
					    </el-date-picker>
					
				</el-form-item>
			</el-form-item>

			</el-form-item>
				<el-form-item label="床位截止时间" prop="overTime">
					<span class="demonstration"></span>
					    <el-date-picker
					      v-model="form.overTime "
					      type="date"
						  value-format="yyyy-MM-dd"
					      placeholder="选择日期">时间
					    </el-date-picker>
					
				</el-form-item>
			</el-form-item>

			<el-form-item label="床位详细信息" prop="bedDetails">
				<el-input v-model="form.bedDetails"></el-input>
			</el-form-item>

			<el-form-item>
				<el-button type="primary" plain @click="save">保存数据</el-button>

			</el-form-item>
		</el-form>
	</div>
</template>

<script>
	export default {
		name: 'bed',
		components: {

		},
		props: [
			'show',
			'editid'
		],
		data() {
			return {
				form: {
					fileNumber: '',
					name: '',
					gender: '',
					startTime: '',
					overTime: '',
					bedDetails: '',
				},
				options: [{
				        value: '选项1',
				        label: '男'
				      },
					  {
				        value: '选项2',
				        label: '女'
				      }], 
				rules: {

					name: [{
							required: true,
							message: '类别名不能为空',
							trigger: 'blur'
						},
						{
							min: 1,
							max: 100,
							message: '长度在 1 到 100 个字符',
							trigger: 'blur'
						}
					]
				},

				bed: [],
				depts: [],
			}
		},
		created() {
			if (this.editid) {
				this.show = true;
				this.$axios.get(
					'bed/getById',
					response => {
						this.form = response.obj
					}, 
					{id: this.editid })
			}
		},
		methods: {
			save() {
				this.axios.get('/bed/add', (data) => {
					if (data) {
						this.$emit('update:show', false)
						this.$emit('getData')
					}

				}, this.form, '保存成功');
			},
			update(){
				this.axios.get('/lifeRemind/update', (data) => {
					if (data) {
						this.$emit('update:show', false)
						this.$emit('getData')
					}
				
				}, this.id,this.status,'更新成功');
		}



	},
}
</script>

<style>
</style>